<template>
	<view class="all">
		<cu-custom bgColor="bg-blue" :isBack="false">
			<block slot="content">高校实训平台</block>
		</cu-custom>
		<view class="blue" style="position: relative;">
			<view>
				<image style="height: 100%;width: 100%;position: absolute;" src="../../static/banner.png" mode="scaleToFill"></image>
			</view>
		</view>
		<view class="rank" @click="sch_cooperate()">
			<view class="orange">
					<image style="height: 150rpx;width: 330rpx;" src="../../static/school.png" mode="aspectFill"></image>
				<!-- <view class="bag1">
					<view class="plate1">
						<view class="cooperate">高校合作</view>
						<view class="integrate">整合本地高校学生</view>
					</view>
					<image src="../../static/index_sch.png" class="index_sch"></image>
				</view> -->
			</view>
			<view class="l_blue" @click="com_apply()">
				<view class="bag2">
					<image style="height: 150rpx;width: 330rpx;" src="../../static/company.png" mode="aspectFill"></image>
					<!-- <view class="plate2">
						<view class="training">企业实训</view>
						<view class="provide">为学生提供实训机会</view>
					</view>
					<image src="../../static/imdex_con.png" class="index_sch"></image> -->
					<!-- <view class="iconfont icon-qiye3 icon_cop2"></view> -->
				</view>
			</view>
		</view>
		<!-- 企业与学校间的切换的组件 -->
		<wzh-change :texts="changeData" @onClick="changeClick" typex=changes></wzh-change>
		<view>
			<view style="width: 100%; height: 1rpx;background-color: rgb(229,229,229);" ></view>
			<!-- 组件的使用 -->
			<!-- <wzh-textlogo text="哈哈哈" @onGetdata="onGetdata" width="150" height="150"></wzh-textlogo> -->

			<!-- 企业推荐模块 -->
			<view class="cu-list menu-avatar" v-if="active==1">
				<view class="cu-item" v-for="(item,index) in list" :key='index' @tap="skip(item.company_id)">
					<view class="cu-avatar round lg" style="background-color: #007AFF;">
						<image style="height: 100%;border-radius: 120rpx;" :src="item.logo" mode="aspectFill" v-if="item.logo"></image>
						<view class="no_img" v-if="!item.logo">{{item.company_name[0]}}</view>
					</view>
					<!-- 组件模块的使用 -->
					<!-- <wzh-textlogo :image="item.logo" :text="item.company_name"></wzh-textlogo> -->
					<view class="content">
						<view>
							<view class="text-black">{{item.company_name}}</view>
						</view>
						<view class="text-gray text-sm flex">
							<view class="text-cut" v-for="(item,index) in item.tags" :key='index'>
								<view style="padding-right: 20rpx;flex-flow: row wrap;">{{item}}</view>
							</view>
						</view>
					</view>
					<view class="action">
						<text class="cuIcon-right text-gray"></text>
					</view>
				</view>
			</view>
			<!-- 学校推荐模块 -->
			<view v-if="active==0">
				<view class="flex box_info" v-for="(item,index) in sch_list" :key="index" @tap="to_parctical(item.school_id)">
					<view>
						<image :src="item.logo" class="img_box" v-if="item.logo"></image>
						<view class="notwo_img" v-if="!item.logo" style="background-color: #007AFF;">{{item.school_name[0]}}</view>
					</view>
					<view class="center_box">
						<view class="shcool_boxtext" style="color: #333333;font-size: 30rpx;">{{item.school_name}}</view>
						<view class="information_text" style="color: #666666;font-size: 27rpx;">{{item.school_id}}</view>
					</view>
					<view class="iconfont icon-you1 right_box"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const {
		appLogin,
		httpGet,
		httpPost,
		msg
	} = require("@/utils/common.js")
	// let app = getApp();
	export default {
		data() {
			return {
				model1: '',
				token: '',
				active: 0,
				page: 1,
				page_size: 20,
				list: [],
				sch_list: [],
				head_list: ['学校推荐','企业推荐'],
				cityList: [{
						value: '赣州',
						label: '赣州'
					},
					{
						value: '南昌',
						label: '南昌'
					},
					{
						value: '九江',
						label: '九江'
					},
				],
				TabCur: 0,
				is_login: false,
				changeData:['学校推荐','企业推荐']
			}
		},
		onLoad() {
				this.gettoken()
				this.getlist()
				this.getlist_sch()
		},
		methods: {
			// 企业学校切换
			changeClick(index){
				console.log(index)
				this.active = index
			},
			// 企业推荐列表
			getlist() {
				httpGet({
					url: '/api/company/list',
					data: {
						page: this.page,
						page_size: this.page_size
					}
				}).then((res) => {
					console.log(res)
					this.list = res.result.list
				})
			},
			// 学校推荐列表
			getlist_sch() {
				httpGet({
					url: '/api/school/list',
					data: {
						page: this.page,
						page_size: this.page_size
					},
				}).then(res => {
					console.log(res)
					this.sch_list = res.result.list
					// console.log(this.list)
				})
			},
			to_com_peopleCententer() {
				uni.navigateTo({
					url: '../company/people_center'
				})
			},
			gettoken() {
				this.token = uni.getStorageSync('token')
				if (this.token) {

				} else {
					this.is_login = true
					console.log(this.token)
				}

			},
			// 进入企业详情
			skip(company_id) {
				if (this.is_login == false) {
					uni.reLaunch({
						url: '../index/login'
					})
					return
				}
				uni.navigateTo({
					url: '../school/enterprise?company_id=' + company_id
				})
			},
			//企业合作按钮
			com_apply() {
				// if (this.is_login == false) {
				// 	uni.reLaunch({
				// 		url: '../index/login'
				// 	})
				// 	return
				// }
				uni.navigateTo({
					url: '../company/apply_company'
				})
			},
			// 进入学校详情
			to_parctical(school_id) {
				// if (this.is_login == false) {
				// 	uni.reLaunch({
				// 		url: '../index/login'
				// 	})
				// 	return
				// }
				uni.navigateTo({
					url: '../company/cooperative_school?school_id=' + school_id
				})
				console.log(school_id)
			},
			// 高校合作按钮
			sch_cooperate() {
				if (this.is_login == false) {
					uni.reLaunch({
						url: '../index/login'
					})
					return
				}
				uni.navigateTo({
					url: '../school/apply_school'
				})
			},
			bindPickerChange: function(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value
			},
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				console.log(this.TabCur)
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
			},
			onGetdata(text) {
				msg(text)
			}
		}
	}
</script>

<style>
	.all {
		background-color: #ffffff;
		.width: 1000rpx;
		height: 1625rpx;
	}

	.select {
		background-color: #0081FF;
		border: 0rpx;
		/* border: #ffffff; */
		color: #ffffff;
		margin-left: 30rpx;
	}

	.blue {
		background-color: rgb(34, 132, 255);
		width: 750rpx;
		height: 350rpx;
	}

	.rank {
		display: flex;
	}

	.orange {
		background-color: #FAEBD7;
		width: 350rpx;
		height: 150rpx;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		margin: 50rpx 35rpx 50rpx 30rpx;
	}

	.bag1 {
		/* margin: 30rpx; */
		display: flex;
	}

	.l_blue {
		background-color: #E6E6FA;
		width: 350rpx;
		height: 150rpx;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		margin: 50rpx 30rpx 50rpx 0rpx;
	}

	.bag2 {
		/* margin: 30rpx; */
		display: flex;
	}

	.plate1 {
		color: orange;
		margin-left: 30rpx;
		margin-top: 35rpx;
		/* line-height: 150rpx; */
	}

	.icon_cop {
		font-size: 90rpx;
		margin-top: 30rpx;
		margin-left: 26rpx;
	}


	.cooperate {
		font-size: 35rpx;
	}
	/* 合作图片 */
	.index_sch{
		width: 90rpx;
		height: 70rpx;
		margin-top: 40rpx;
		margin-left: 20rpx;
		text-align: center;
	}

	.integrate {
		font-size: 20rpx;
		color: grey;
		margin: 5rpx;
	}

	.plate2 {
		color: #1E90FF;
		margin-left: 30rpx;
		margin-top: 35rpx;
	}

	/* 	.cu-item{
		padding-top: 35rpx;
		padding-bottom: 35rpx;
		height: 170rpx;
	} */
	.no_img {
		height: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		/* background-color: #1E90FF; */
		text-align: center;
		line-height: 100rpx;
		/* font-size: 30rpx; */
	}

	.training {
		font-size: 35rpx;
	}

	.provide {
		font-size: 20rpx;
		color: grey;
		margin: 5rpx;
	}

	.recommendation {
		font-weight: 600;
		font-size: 35rpx;
		margin: 15rpx;
	}

	.more {
		color: gray;
		float: right;
		margin: 5rpx 30rpx 5rpx 15rpx;
	}

	.line {
		border-top: solid rgb(229, 229, 229) 1rpx;
		margin: 10rpx 0rpx 10rpx 0rpx;
	}

	.mine {
		width: 40rpx;
		height: 50rpx;
		color: orange;
	}

	.bag_1 {
		position: absolute;
		top: 600rpx;
		left: 300rpx;
		color: orange;
	}

	.foot {
		margin-top: 10rpx;
	}

	.sign-one {
		color: #F37B1D;

	}

	/* 企业与学校间的切换样式 */


	.notwo_img {
		width: 100rpx;
		height: 100rpx;
		text-align: center;
		line-height: 100rpx;
		color: #FFFFFF;
		font-size: 60rpx;
		border-radius: 16rpx;
	}

	/* 学校推荐模块样式 */
	.sch_box {
		margin-top: 30rpx;
	}

	.box_info {
		border-width: 2rpx;
		border-bottom-style: solid;
		border-color: #e7e7e7;
		height: 175rpx;
		padding-left: 30rpx;
		padding-top: 40rpx;
		background-color: #FFFFFF;
	}

	.img_box {
		width: 94rpx;
		height: 94rpx;
		border-radius: 15rpx;
	}

	.center_box {
		margin-left: 29rpx;
		margin-top: 5rpx;
	}

	.shcool_boxtext {
		color: #333333;
		font-size: 30rpx;
		margin-bottom: 15rpx;
	}

	.information_text {
		color: #666666;
		font-size: 27rpx;
	}

	.right_box {
		position: absolute;
		right: 34rpx;
		color: #bcbcbc;
		font-size: 28rpx;
		margin-top: 35rpx;
	}
</style>
